class OutOfOffice implements Comparable {

    Date outDate
    Date inDate
    String notes

    static constraints = {
        outDate(nullable:false)
        inDate(nullable:false)
        notes(nullable:true, maxSize:2048)
    }

    int compareTo(obj) {
        if (outDate.equals(obj.outDate)) {
            if (inDate.equals(obj.inDate)) {
                notes.compareTo(obj.notes)
            } else {
                return obj.inDate.equals(inDate)
            }
        }
        obj.outDate.compareTo(outDate)
    }
}
